package com.sailfish.springbootdemo.controller.db1;

import com.sailfish.springbootdemo.pojo.Result;
import com.sailfish.springbootdemo.service.db1.CoreAlgorithmService;
import com.sailfish.springbootdemo.service.db1.RoadmapCmService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/roadmapCm")
@CrossOrigin
public class RoadmapCmController {

    @Autowired
    private RoadmapCmService roadmapCmService;

    @Autowired
    private CoreAlgorithmService coreAlgorithmService;

    @PostMapping("/updateRoadmapCmByBigTypeAndCompany")
    public Result updateRoadmapCmByBigTypeAndCompany(@RequestBody String data) {
        return roadmapCmService.updateRoadmapCmByBigTypeAndCompany(data);
    }

    @PostMapping("/calcRoadmapCmIsMatchH3c")
    public Result calcRoadmapCmIsMatchH3c(Integer valueAlgorithmType, Integer ruleAlgorithmType, String h3cValue, String cmValue) {
        return coreAlgorithmService.calcRoadmapCmIsMatchH3c(valueAlgorithmType, ruleAlgorithmType, h3cValue, cmValue);
    }

    @PostMapping("/exportExcelOfCMRoadmaps")
    public Result exportExcelOfCMRoadmaps(String pcbaCompanyIdsStr, Integer year, Integer versionY, String versionN) {
        return roadmapCmService.exportExcelOfCMRoadmaps(pcbaCompanyIdsStr, year, versionY, versionN);
    }

    @PostMapping("/importRoadmapCmExcel")
    public Result importRoadmapCmExcel(MultipartFile file, Integer pcbaCompanyId) {
        return roadmapCmService.importRoadmapCmExcel(file, pcbaCompanyId);
    }
}
